import request from '@/utils/request'

// 登录的api
export const login = data => {
  return request({
    url: '/login',
    method: 'POST',
    data
  })
}

// 注册时候，获取验证码
export const sendsms = data => {
  return request({
    url: '/sendsms',
    method: 'POST',
    data
  })
}

// 注册
export const register = data => {
  return request({
    url: '/register',
    method: 'POST',
    data
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return request({
    url: '/info'
  })
}

// 退出
export const logout = () => {
  return request({
    url: '/logout'
  })
}

// 获取用户列表
export const getUserList = params => {
  return request({
    url: '/user/list',
    params
  })
}

// 更改用户状态
export const changeStatus = id => {
  return request({
    url: '/user/status',
    method: 'POST',
    data: {
      id
    }
  })
}

// 删除用户
export const delUser = id => {
  return request({
    url: '/user/remove',
    method: 'POST',
    data: {
      id
    }
  })
}

// 新增用户
export const addUser = data => {
  return request({
    url: '/user/add',
    method: 'POST',
    data
  })
}

// 修改用户
export const updateUser = data => {
  return request({
    url: '/user/edit',
    method: 'POST',
    data
  })
}
